﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Platform.Storage.Redis.Messages
{
	/// <summary>
	/// String retornado pelo REDIS
	/// </summary>
	public class StringRedisMessage : RedisMessageBase<String>
	{
		public StringRedisMessage( RedisMessageChannel channel, string command, string[] parameters )
			: base( channel, command, parameters )
		{ }

		protected override string GetReply( Func<RedisReplyLine> nextLine )
		{
			var line = nextLine();

			if ( line.Reply == RedisReplyStatus.Success
				|| line.Reply == RedisReplyStatus.CollectionItem )
				return line.Message;
			else
				return String.Empty;
		}
	}
}
